home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Genie / Projects / A-line / Scripts / QuotePaths < prev    next >
Encoding:
Text File  |  2000-06-24  |  1014 b   |  55 lines

  1. # QuotePaths
  2. #
  3. # QuotePaths <base> <sub> <dir1> <dir2> ... <dirn>
  4. # --> 'Base:Dir1:Sub:' 'Root:Dir2:Sub:' ... 'Root:Dirn:Sub:'
  5. # (with aliases resolved).
  6. #
  7. # Stupid script to construct, quote, resolve, and quote pathnames.
  8. # Plus, it quotes them for good measure.  Loathe MPW, dream of Unix...
  9.  
  10. set PROCESS Quote
  11.  
  12. loop
  13.     # Break on non-option.
  14.     if "{1}" == "--"
  15.         break
  16.     else if "{1}" !~ /-?+/
  17.         break
  18.     else if "{1}" == "-b"
  19.         set BASE "{2}"
  20.         shift
  21.     else if "{1}" == "-s"
  22.         set SUBDIR ":{2}"
  23.         shift
  24.     else if "{1}" == "-r"
  25.         set PROCESS ResolveAlias
  26.     else if "{1}" == "-p"
  27.         Set PRESERVE yup
  28.     else if "{1}" == "-qd"
  29.         shift
  30.         superquote -d `"{0}" {"parameters"}`
  31.         exit
  32.     else if "{1}" == "-q"
  33.         shift
  34.         superquote -x `"{0}" {"parameters"}`
  35.         exit
  36.     else
  37.         echo "QuotePaths: warning: unknown option '{1}'." > Dev:console
  38.     end
  39.     shift
  40. end
  41.  
  42. If "{PRESERVE}"
  43.     for dir in {parameters}
  44.         Echo -n "∂∂∂"{BASE}{dir}{SUBDIR}∂∂∂" "
  45.     end
  46. Else
  47.     for dir in {parameters}
  48.         {PROCESS} "{BASE}{dir}{SUBDIR}"
  49.     end
  50. End
  51.  
  52.  
  53. exit
  54. # The end.
  55.